//
//  LDBossPositionHeaderView.swift
//  DingDongZP
//
//  Created by 杨政涛 on 16/7/7.
//  Copyright © 2016年 51ledian.com. All rights reserved.
//

import UIKit

class LDBossPositionHeaderView: UIView {
    
    var countSeeResumeLab:UILabel?
    var countInterestLab:UILabel?
    var countShareLab:UILabel?
    
    
    var imageView1:UIImageView?
    var imageView2:UIImageView?
    var imageView3:UIImageView?
    
    var label1:UILabel?
    var label2:UILabel?
    var label3:UILabel?
    
    let divideLine1 = UIImageView.setupDivideLine_V(60)
    let divideLine2 = UIImageView.setupDivideLine_V(60)
    
    var gampView:UIView?
    var gampViewBg:UIView?
    
    var model:myResumeHeadViewModel? {
        
        didSet{
            updateContent()
        }
    }
    override init(frame: CGRect) {
        super.init(frame: frame)
        setDefaultContent()
        setupFrame()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    func updateContent() {
        countSeeResumeLab?.text = model?.resumehits
        countInterestLab?.text = model?.resumeinterestedcount
        countShareLab?.text = model?.resumeh5hits
    }
    func setDefaultContent() {
        
        
        gampViewBg = UIView.init(frame: self.frame)
        gampViewBg?.backgroundColor = LDBackGoundColorGray
        
        gampView = UIView.init(frame: CGRectMake(0, 0, self.frame.size.width, self.frame.size.height - LDCellFrame.Margin_V))
        gampView?.backgroundColor = LDGolbalColor.White
        
        imageView1 = UIImageView.init(image: UIImage.init(named: "查看.png"))
        imageView2 = UIImageView.init(image: UIImage.init(named: "感兴趣1.png"))
        imageView3 = UIImageView.init(image: UIImage.init(named: "分享带来的展示1.png"))
        
        label1 = UILabel.setDetailsLab("人查看了微简历", fontSize: 13, titleColor: LDFontColor.DeepGray,Alignment: NSTextAlignment.Center)
        
        label2 = UILabel.setDetailsLab("人对简历感兴趣", fontSize: 13, titleColor: LDFontColor.DeepGray,Alignment: NSTextAlignment.Center)
        
        label3 = UILabel.setDetailsLab("分享带来的展示", fontSize: 13, titleColor: LDFontColor.DeepGray,Alignment: NSTextAlignment.Center)
        
        
        countSeeResumeLab = UILabel.setDetailsLab("0", fontSize: 30, titleColor: LDFontColor.DeepGray,Alignment: NSTextAlignment.Center)
        
        countInterestLab = UILabel.setDetailsLab("0", fontSize: 30, titleColor: LDFontColor.DeepGray,Alignment: NSTextAlignment.Center)
        
        countShareLab = UILabel.setDetailsLab("0", fontSize: 30, titleColor: LDFontColor.DeepGray
            ,Alignment: NSTextAlignment.Center)
        
        gampViewBg?.addSubview(gampView!)
        addSubview(gampViewBg!)
        
        gampView!.addSubview(divideLine1)
        gampView!.addSubview(divideLine2)
        
        gampView!.addSubview(imageView1!)
        gampView!.addSubview(imageView2!)
        gampView!.addSubview(imageView3!)
        gampView!.addSubview(label1!)
        gampView!.addSubview(label2!)
        gampView!.addSubview(label3!)
        gampView!.addSubview(countSeeResumeLab!)
        gampView!.addSubview(countInterestLab!)
        gampView!.addSubview(countShareLab!)
    }
    func setupFrame() {
        
        divideLine1.snp_makeConstraints { (make) in
           
            make.top.equalTo(self).inset(10)
            make.width.equalTo(1)
            make.height.equalTo(60)
            make.left.equalTo(LDFrame.ScreenWidth/3)
        }
        divideLine2.snp_makeConstraints { (make) in
           
            make.top.equalTo(self).inset(10)
            make.width.equalTo(1)
            make.height.equalTo(60)
            make.left.equalTo(LDFrame.ScreenWidth*2/3)
        }
        //1
        
        imageView1?.snp_makeConstraints(closure: { (make) in
            make.top.equalTo(20)
            make.left.equalTo(20)
            make.width.equalTo(20)
            make.height.equalTo(13)
        })
        countSeeResumeLab?.snp_makeConstraints(closure: { (make) in
            make.top.equalTo(10)
            make.right.equalTo(divideLine1)
            make.height.equalTo(30)
            make.width.equalTo(80)
        })
        label1?.snp_makeConstraints(closure: { (make) in
            make.left.equalTo(0)
            make.right.equalTo(divideLine1)
            make.height.equalTo(15)
            make.bottom.equalTo(divideLine1.snp_bottom)
        })
        
        //2
        imageView2?.snp_makeConstraints(closure: { (make) in
            make.top.equalTo(20)
            make.left.equalTo(divideLine1.snp_right).offset(20)
            make.width.equalTo(18)
            make.height.equalTo(16)
        })
        countInterestLab?.snp_makeConstraints(closure: { (make) in
            make.top.equalTo(10)
            make.right.equalTo(divideLine2)
            make.height.equalTo(30)
            make.width.equalTo(80)
        })
        label2?.snp_makeConstraints(closure: { (make) in
            make.left.equalTo(divideLine1)
            make.right.equalTo(divideLine2)
            make.height.equalTo(15)
            make.bottom.equalTo(divideLine1.snp_bottom)
        })
        //3
        imageView3?.snp_makeConstraints(closure: { (make) in
            make.top.equalTo(20)
            make.left.equalTo(divideLine2.snp_right).offset(20)
            make.width.equalTo(16)
            make.height.equalTo(16)
        })
        countShareLab?.snp_makeConstraints(closure: { (make) in
            make.top.equalTo(10)
            make.right.equalTo(LDFrame.ScreenWidth)
            make.height.equalTo(30)
            make.width.equalTo(80)
        })
        label3?.snp_makeConstraints(closure: { (make) in
            make.right.equalTo(LDFrame.ScreenWidth)
            make.left.equalTo(divideLine2)
            make.height.equalTo(15)
            make.bottom.equalTo(divideLine2.snp_bottom)
        })
        
    }
}
